flag_package: Vec<String>,
flag_jobs: Option<u32>,
flag_features: Vec<String>,
+ flag_all_features: bool,
flag_no_default_features: bool,
flag_target: Option<String>,
flag_manifest_path: Option<String>,
-p SPEC, --package SPEC ... Package to run benchmarks for
-j N, --jobs N Number of parallel jobs, defaults to # of CPUs
--features FEATURES Space-separated list of features to also build
+ --all-features Build all available features
--no-default-features Do not build the `default` feature
--target TRIPLE Build for the target triple
--manifest-path PATH Path to the manifest to build benchmarks for
jobs: options.flag_jobs,
target: options.flag_target.as_ref().map(|s| &s[..]),
features: &options.flag_features,
+ all_features: options.flag_all_features,
no_default_features: options.flag_no_default_features,
spec: &options.flag_package,
exec_engine: None,
flag_package: Vec<String>,
flag_jobs: Option<u32>,
flag_features: Vec<String>,
+ flag_all_features: bool,
flag_no_default_features: bool,
flag_target: Option<String>,
flag_manifest_path: Option<String>,
--bench NAME Build only the specified benchmark target
--release Build artifacts in release mode, with optimizations
--features FEATURES Space-separated list of features to also build
+ --all-features Build all available features
--no-default-features Do not build the `default` feature
--target TRIPLE Build for the target triple
--manifest-path PATH Path to the manifest to compile
jobs: options.flag_jobs,
target: options.flag_target.as_ref().map(|t| &t[..]),
features: &options.flag_features,
+ all_features: options.flag_all_features,
no_default_features: options.flag_no_default_features,
spec: &options.flag_package,
exec_engine: None,
pub struct Options {
flag_target: Option<String>,
flag_features: Vec<String>,
+ flag_all_features: bool,
flag_jobs: Option<u32>,
flag_manifest_path: Option<String>,
flag_no_default_features: bool,
--bin NAME Document only the specified binary
--release Build artifacts in release mode, with optimizations
--features FEATURES Space-separated list of features to also build
+ --all-features Build all available features
--no-default-features Do not build the `default` feature
--target TRIPLE Build for the target triple
--manifest-path PATH Path to the manifest to document
jobs: options.flag_jobs,
target: options.flag_target.as_ref().map(|t| &t[..]),
features: &options.flag_features,
+ all_features: options.flag_all_features,
no_default_features: options.flag_no_default_features,
spec: &options.flag_package,
exec_engine: None,
pub struct Options {
flag_jobs: Option<u32>,
flag_features: Vec<String>,
+ flag_all_features: bool,
flag_no_default_features: bool,
flag_debug: bool,
flag_bin: Vec<String>,
Build and install options:
-h, --help Print this message
-j N, --jobs N Number of parallel jobs, defaults to # of CPUs
- --features FEATURES Space-separated list of features to activate
-f, --force Force overwriting existing crates or binaries
+ --features FEATURES Space-separated list of features to activate
+ --all-features Build all available features
--no-default-features Do not build the `default` feature
--debug Build in debug mode instead of release mode
--bin NAME Only install the binary NAME
jobs: options.flag_jobs,
target: None,
features: &options.flag_features,
+ all_features: options.flag_all_features,
no_default_features: options.flag_no_default_features,
spec: &[],
exec_engine: None,
pub struct Options {
flag_color: Option<String>,
flag_features: Vec<String>,
+ flag_all_features: bool,
flag_format_version: u32,
flag_manifest_path: Option<String>,
flag_no_default_features: bool,
Options:
-h, --help Print this message
--features FEATURES Space-separated list of features
+ --all-features Build all available features
--no-default-features Do not include the `default` feature
--no-deps Output information only about the root package
and don't fetch dependencies.
let options = OutputMetadataOptions {
features: options.flag_features,
+ all_features: options.flag_all_features,
no_default_features: options.flag_no_default_features,
no_deps: options.flag_no_deps,
version: options.flag_format_version,
flag_example: Option<String>,
flag_jobs: Option<u32>,
flag_features: Vec<String>,
+ flag_all_features: bool,
flag_no_default_features: bool,
flag_target: Option<String>,
flag_manifest_path: Option<String>,
-j N, --jobs N Number of parallel jobs, defaults to # of CPUs
--release Build artifacts in release mode, with optimizations
--features FEATURES Space-separated list of features to also build
+ --all-features Build all available features
--no-default-features Do not build the `default` feature
--target TRIPLE Build for the target triple
--manifest-path PATH Path to the manifest to execute
jobs: options.flag_jobs,
target: options.flag_target.as_ref().map(|t| &t[..]),
features: &options.flag_features,
+ all_features: options.flag_all_features,
no_default_features: options.flag_no_default_features,
spec: &[],
exec_engine: None,
flag_package: Option<String>,
flag_jobs: Option<u32>,
flag_features: Vec<String>,
+ flag_all_features: bool,
flag_no_default_features: bool,
flag_target: Option<String>,
flag_manifest_path: Option<String>,
--release Build artifacts in release mode, with optimizations
--profile PROFILE Profile to build the selected target for
--features FEATURES Features to compile for the package
+ --all-features Build all available features
--no-default-features Do not compile default features for the package
--target TRIPLE Target triple which compiles will be for
--manifest-path PATH Path to the manifest to fetch dependencies for
jobs: options.flag_jobs,
target: options.flag_target.as_ref().map(|t| &t[..]),
features: &options.flag_features,
+ all_features: options.flag_all_features,
no_default_features: options.flag_no_default_features,
spec: &options.flag_package.map_or(Vec::new(), |s| vec![s]),
exec_engine: None,
arg_opts: Vec<String>,
flag_target: Option<String>,
flag_features: Vec<String>,
+ flag_all_features: bool,
flag_jobs: Option<u32>,
flag_manifest_path: Option<String>,
flag_no_default_features: bool,
--bench NAME Build only the specified benchmark target
--release Build artifacts in release mode, with optimizations
--features FEATURES Space-separated list of features to also build
+ --all-features Build all available features
--no-default-features Do not build the `default` feature
--target TRIPLE Build for the target triple
--manifest-path PATH Path to the manifest to document
jobs: options.flag_jobs,
target: options.flag_target.as_ref().map(|t| &t[..]),
features: &options.flag_features,
+ all_features: options.flag_all_features,
no_default_features: options.flag_no_default_features,
spec: &options.flag_package.map_or(Vec::new(), |s| vec![s]),
exec_engine: None,
pub struct Options {
arg_args: Vec<String>,
flag_features: Vec<String>,
+ flag_all_features: bool,
flag_jobs: Option<u32>,
flag_manifest_path: Option<String>,
flag_no_default_features: bool,
-j N, --jobs N Number of parallel jobs, defaults to # of CPUs
--release Build artifacts in release mode, with optimizations
--features FEATURES Space-separated list of features to also build
+ --all-features Build all available features
--no-default-features Do not build the `default` feature
--target TRIPLE Build for the target triple
--manifest-path PATH Path to the manifest to build tests for
jobs: options.flag_jobs,
target: options.flag_target.as_ref().map(|s| &s[..]),
features: &options.flag_features,
+ all_features: options.flag_all_features,
no_default_features: options.flag_no_default_features,
spec: &options.flag_package,
exec_engine: None,
pub fn package_id(&self) -> &PackageId { self.manifest.package_id() }
pub fn root(&self) -> &Path { self.manifest_path.parent().unwrap() }
pub fn summary(&self) -> &Summary { self.manifest.summary() }
- pub fn targets(&self) -> &[Target] { self.manifest().targets() }
+ pub fn targets(&self) -> &[Target] { self.manifest.targets() }
pub fn version(&self) -> &Version { self.package_id().version() }
pub fn authors(&self) -> &Vec<String> { &self.manifest.metadata().authors }
pub fn publish(&self) -> bool { self.manifest.publish() }
pub target: Option<&'a str>,
/// Extra features to build for the root package
pub features: &'a [String],
+ /// Flag whether all available features should be built for the root package
+ pub all_features: bool,
/// Flag if the default feature should be built for the root package
pub no_default_features: bool,
/// Root package to build (if None it's the current one)
pub fn resolve_dependencies<'a>(ws: &Workspace<'a>,
source: Option<Box<Source + 'a>>,
features: Vec<String>,
+ all_features: bool,
no_default_features: bool)
-> CargoResult<(PackageSet<'a>, Resolve)> {
try!(add_overrides(&mut registry, ws));
- let method = Method::Required{
- dev_deps: true, // TODO: remove this option?
- features: &features,
- uses_default_features: !no_default_features,
+ let method = if all_features {
+ Method::Everything
+ } else {
+ Method::Required {
+ dev_deps: true, // TODO: remove this option?
+ features: &features,
+ uses_default_features: !no_default_features,
+ }
};
let resolved_with_overrides =
-> CargoResult<ops::Compilation<'a>> {
let root_package = try!(ws.current());
let CompileOptions { config, jobs, target, spec, features,
- no_default_features, release, mode,
+ all_features, no_default_features,
+ release, mode,
ref filter, ref exec_engine,
ref target_rustdoc_args,
ref target_rustc_args } = *options;
}
let (packages, resolve_with_overrides) = {
- try!(resolve_dependencies(ws, source, features, no_default_features))
+ try!(resolve_dependencies(ws, source, features, all_features, no_default_features))
};
let mut pkgids = Vec::new();
pub struct OutputMetadataOptions {
pub features: Vec<String>,
pub no_default_features: bool,
+ pub all_features: bool,
pub no_deps: bool,
pub version: u32,
}
let deps = try!(ops::resolve_dependencies(ws,
None,
opt.features.clone(),
+ opt.all_features,
opt.no_default_features));
let (packages, resolve) = deps;
target: None,
features: &[],
no_default_features: false,
+ all_features: false,
spec: &[],
filter: ops::CompileFilter::Everything,
exec_engine: None,
bench)
_arguments \
'--features=[space separated feature list]' \
+ '--all-features[enable all available features]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
"${command_scope_spec[@]}" \
build)
_arguments \
'--features=[space separated feature list]' \
+ '--all-features[enable all available features]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
"${command_scope_spec[@]}" \
doc)
_arguments \
'--features=[space separated feature list]' \
+ '--all-features[enable all available features]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
'--manifest-path=[path to manifest]: :_files -/' \
'--debug[build in debug mode instead of release mode]' \
'--example[install the specified example instead of binaries]' \
'--features=[space separated feature list]' \
+ '--all-features[enable all available features]' \
'--git=[URL from which to install the crate]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
'--no-default-features[do not include the default feature]' \
'--manifest-path=[path to manifest]: :_files -/' \
'--features=[space separated feature list]' \
+ '--all-features[enable all available features]' \
'--format-version=[format version(default: 1)]' \
'--color=:colorization option:(auto always never)' \
;;
_arguments \
'--example=[name of the bin target]' \
'--features=[space separated feature list]' \
+ '--all-features[enable all available features]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
'--manifest-path=[path to manifest]: :_files -/' \
_arguments \
'--color=:colorization option:(auto always never)' \
'--features=[features to compile for the package]' \
+ '--all-features[enable all available features]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \
'--manifest-path=[path to the manifest to fetch dependencies for]' \
_arguments \
'--color=:colorization option:(auto always never)' \
'--features=[space-separated list of features to also build]' \
+ '--all-features[enable all available features]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-j, --jobs)'{-j,--jobs}'=[number of parallel jobs, defaults to # of CPUs]' \
'--manifest-path=[path to the manifest to document]' \
test)
_arguments \
'--features=[space separated feature list]' \
+ '--all-features[enable all available features]' \
'(-h, --help)'{-h,--help}'[show help message]' \
'(-j, --jobs)'{-j,--jobs}'[number of parallel jobs, defaults to # of CPUs]' \
'--manifest-path=[path to manifest]: :_files -/' \
local opt_color='--color'
local opt_common="$opt_help $opt_verbose $opt_quiet $opt_color"
local opt_pkg='-p --package'
- local opt_feat='--features --no-default-features'
+ local opt_feat='--features --all-features --no-default-features'
local opt_mani='--manifest-path'
local opt_jobs='-j --jobs'
.RS
.RE
.TP
+.B \-\-all\-features
+Build all available features.
+.RS
+.RE
+.TP
.B \-\-no\-default\-features
Do not build the \f[C]default\f[] feature.
.RS
.RS
.RE
.TP
+.B \-\-all\-features
+Build all available features.
+.RS
+.RE
+.TP
.B \-\-features \f[I]FEATURES\f[]
Space\-separated list of features to also build.
.RS
.RS
.RE
.TP
+.B \-\-all\-features
+Build all available features.
+.RS
+.RE
+.TP
.B \-\-no\-default\-features
Do not build the \f[C]default\f[] feature.
.RS
.RS
.RE
.TP
+.B \-\-all\-features
+Build all available features.
+.RS
+.RE
+.TP
.B \-f, \-\-force
Force overwriting existing crates or binaries
.RS
.RS
.RE
.TP
+.B \-\-all\-features
+Build all available features.
+.RS
+.RE
+.TP
.B \-\-no\-default\-features
Do not include the \f[C]default\f[] feature.
.RS
.RS
.RE
.TP
+.B \-\-all\-features
+Build all available features.
+.RS
+.RE
+.TP
.B \-\-no\-default\-features
Do not build the \f[C]default\f[] feature.
.RS
.RS
.RE
.TP
+.B \-\-all\-features
+Build all available features.
+.RS
+.RE
+.TP
.B \-\-no\-default\-features
Do not compile default features for the package.
.RS
.RS
.RE
.TP
+.B \-\-all\-features
+Build all available features.
+.RS
+.RE
+.TP
.B \-\-no\-default\-features
Do not build the \f[C]default\f[] feature.
.RS
.RS
.RE
.TP
+.B \-\-all\-features
+Build all available features.
+.RS
+.RE
+.TP
.B \-\-no\-default\-features
Do not build the \f[C]default\f[] feature.
.RS
execs().with_status(101).with_stderr("\
[ERROR] feature names may not contain slashes: `bar/some-feat`
"));
+
+#[test]
+fn all_features_flag_enables_all_features() {
+ let p = project("foo")
+ .file("Cargo.toml", r#"
+ [project]
+ name = "foo"
+ version = "0.0.1"
+ authors = []
+
+ [features]
+ foo = []
+ bar = []
+
+ [dependencies.baz]
+ path = "baz"
+ optional = true
+ "#)
+ .file("src/main.rs", r#"
+ #[cfg(feature = "foo")]
+ pub fn foo() {}
+
+ #[cfg(feature = "bar")]
+ pub fn bar() {
+ extern crate baz;
+ baz::baz();
+ }
+
+ fn main() {
+ foo();
+ bar();
+ }
+ "#)
+ .file("baz/Cargo.toml", r#"
+ [package]
+ name = "baz"
+ version = "0.0.1"
+ authors = []
+ "#)
+ .file("baz/src/lib.rs", "pub fn baz() {}");
+
+ assert_that(p.cargo_process("build").arg("--all-features"),
+ execs().with_status(0));
+}
}